import createAutoImport from './auto-import'
import createSetup from './setup-extend'
import createCompression from './compression'
import buildLifeHooks from './buildLifeHooks'
import vue from '@vitejs/plugin-vue'

export default function createPlugin(viteEnv, isBuild = false) {
  const vitePlugins = [vue()]
  vitePlugins.push(createAutoImport())
  vitePlugins.push(createSetup())
  isBuild && vitePlugins.push(createCompression(viteEnv))
  isBuild && vitePlugins.push(buildLifeHooks())
  return vitePlugins
}
